<template>
  <div>
    <div class="container">
      <div class="c_banner">
        <div class="c_banner_title">{{ $t("服务支持") }}</div>
        <img class="c_banner_img" src="~/assets/images/c_banner7.png" alt="" />
      </div>
      <div class="c_content">
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/' }">{{
            $t("首页")
          }}</el-breadcrumb-item>
          <el-breadcrumb-item :to="{ path: 'serviceSupport' }">{{
            $t("服务支持")
          }}</el-breadcrumb-item>
          <el-breadcrumb-item>{{ indexData.title }}</el-breadcrumb-item>
        </el-breadcrumb>
        <el-row style="margin-top: 56rem">
          <el-col :span="24">
            <div class="c_full">
              <img class="c_full_img" :src="indexData.scene" alt="" />
              <div class="c_full_view">
                <div class="c_full_f1">{{ $t("产品手册PDF") }}</div>
                <div class="c_full_f2">{{ indexData.title }}</div>
                <div class="c_full_f3">{{ indexData.features }}</div>
                <div class="c_see_detail">
                  <div class="c_btn1" @click="dialogVisible = true">
                    {{ $t("预览") }}
                  </div>
                  <div class="c_btn2" @click="downloadFile">
                    {{ $t("下载") }}
                  </div>
                </div>
              </div>
            </div>
          </el-col>
        </el-row>
        <!-- 安装使用视频 -->
        <div class="c_hexin">
          <div class="c_title">{{ $t("安装使用视频") }}</div>
          <div class="c_videobox">
            <video
              ref="myVideo"
              class="c_video"
              :controls="true"
              :src="indexData.video"
            ></video>
          </div>
        </div>
        <!-- 常见问题 -->
        <div class="c_hexin">
          <div class="c_title">{{ $t("常见问题") }}</div>
          <div
            class="c_QA"
            v-for="item in indexData.questionList"
            :key="item.id"
          >
            <div class="c_Q">{{ item.title }}</div>
            <div class="c_A">{{ item.content }}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="container_mobile">
      <div class="c_banner">
        <div class="c_banner_title">{{ $t("服务支持") }}</div>
        <img class="c_banner_img" src="~/assets/images/c_banner7.png" alt="" />
      </div>
      <div class="c_content">
        <div class="c_full">
          <img class="c_full_img" :src="indexData.thumb" alt="" />
          <div class="c_full_view">
            <div class="c_full_f1">{{ "产品手册PDF" }}</div>
            <div class="c_full_f2">{{ indexData.title }}</div>
            <div class="c_full_f3">{{ indexData.info }}</div>
            <div class="c_see_detail">
              <div class="c_btn2" @click="downloadFile">{{ $t("下载") }}</div>
              <div class="c_btn1" @click="dialogVisible = true">
                {{ $t("预览") }}
              </div>
            </div>
          </div>
        </div>
        <!-- 安装使用视频 -->
        <div class="c_hexin">
          <div class="c_title">{{ $t("安装使用视频") }}</div>
          <div class="c_videobox">
            <video
              ref="myVideo"
              class="c_video"
              :controls="true"
              :src="indexData.video"
            ></video>
          </div>
        </div>
        <!-- 常见问题 -->
        <div class="c_hexin">
          <div class="c_title">{{ $t("常见问题") }}</div>
          <div
            class="c_QA"
            v-for="item in indexData.questionList"
            :key="item.id"
          >
            <div class="c_Q">{{ item.title }}</div>
            <div class="c_A">{{ item.content }}</div>
          </div>
        </div>
        <div style="height: 200rem"></div>
      </div>
    </div>
    <el-dialog
      :visible.sync="dialogVisible"
      :before-close="handleClose"
      width="90%"
      top="10vh"
    >
      <iframe
        width="100%"
        height="700px"
        :src="indexData.pdf"
        frameborder="0"
      ></iframe>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogVisible: false,
    };
  },
  async asyncData({ $indexApi, query }) {
    const res = await $indexApi.getServiceData({ id: query.id });
    // console.log(res.data);

    return {
      indexData: res.data,
    };
  },
  methods: {
    downloadFile() {
      window.open(this.indexData.pdf);
    },
    handleClose() {
      this.dialogVisible = false;
    },
  },
};
</script>

<style lang="less" scoped>
@media (min-width: 900px) {
  .container_mobile {
    display: none;
  }
  .container {
    display: block;
    .c_banner {
      width: 100%;
      height: 560rem;
      position: relative;

      .c_banner_title {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 60rem;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #333333;
      }

      .c_banner_img {
        width: 100%;
        height: 100%;
      }
    }

    .c_content {
      padding: 40rem 100rem 150rem 100rem;
      background: #fafafa;

      .c_hexin {
        .c_title {
          font-size: 54rem;
          font-family: Source Han Sans CN;
          font-weight: bold;
          color: #333333;
          margin: 120rem 0 100rem 0;
          text-align: center;
        }

        .c_QA {
          padding: 40rem 0 20rem 0;
          border-bottom: 1px solid #f5f5f5;
          .c_Q {
            font-size: 24rem;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #333333;
            line-height: 48rem;
          }
          .c_A {
            font-size: 20rem;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #999999;
            line-height: 48rem;
          }
        }

        .c_videobox {
          box-sizing: border-box;
          border: 0;
          width: 100%;
          height: 800rem;
          position: relative;

          .c_video {
            width: 100%;
            height: 100%;
            border-radius: 10px;
          }
        }
      }

      .c_full {
        display: flex;
        margin-bottom: 20px;
        background: #fff;
        border-radius: 20rem;
        overflow: hidden;
        &:hover {
          .c_full_img {
            transform: scale(1.2);
          }
        }

        .c_full_img {
          width: 50%;
          height: 500rem;
          border-radius: 20rem 0 0 20rem;
          transition: 0.6s;
        }

        .c_radius {
          border-radius: 0 20rem 20rem 0;
        }

        .c_full_view {
          width: 50%;
          padding: 0 150rem;
          display: flex;
          flex-direction: column;
          justify-content: center;

          .c_full_f1 {
            font-size: 40rem;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #333333;
          }

          .c_full_f2 {
            margin-top: 20rem;
            font-size: 24rem;
            font-family: Source Han Sans CN;
            font-weight: 300;
            color: #333333;
          }

          .c_full_f3 {
            margin-top: 20rem;
            font-size: 20rem;
            font-family: Source Han Sans CN;
            font-weight: 300;
            color: #999999;
          }

          .c_see_detail {
            display: flex;
            align-items: center;
            margin-top: 90rem;

            .c_btn1 {
              font-size: 14rem;
              font-family: Source Han Sans CN;
              font-weight: 400;
              color: #333333;
              width: 80rem;
              height: 40rem;
              border: 1px solid #333333;
              border-radius: 4rem;
              text-align: center;
              line-height: 40rem;
              cursor: pointer;
              transition: 0.6s;
            }

            .c_btn2 {
              margin-left: 70rem;
              font-size: 14rem;
              font-family: Source Han Sans CN;
              font-weight: 400;
              color: #fff;
              width: 80rem;
              height: 40rem;
              background: #333333;
              border-radius: 4rem;
              text-align: center;
              line-height: 40rem;
              cursor: pointer;
              transition: 0.6s;
              &:hover {
                background: #000;
              }
            }
          }
        }
      }
    }
  }
}
@media (max-width: 900px) {
  .container {
    display: none;
  }
  .container_mobile {
    display: block;
    .c_banner {
      width: 100%;
      height: 240px;
      position: relative;

      .c_banner_title {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #333333;
      }

      .c_banner_img {
        width: 100%;
        height: 100%;
      }
    }

    .c_content {
      padding: 10px;
      background: #fafafa;

      .c_hexin {
        .c_title {
          font-size: 18px;
          font-family: Source Han Sans CN;
          font-weight: bold;
          color: #333333;
          margin: 22px 0;
          text-align: center;
        }

        .c_QA {
          padding: 15px 0;
          border-bottom: 1px solid #f5f5f5;
          .c_Q {
            font-size: 12px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #333333;
            line-height: 20px;
          }
          .c_A {
            font-size: 10px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #999999;
            line-height: 16px;
          }
        }

        .c_videobox {
          box-sizing: border-box;
          border: 0;
          width: 100%;
          height: 183px;
          position: relative;

          .c_video {
            width: 100%;
            height: 100%;
            border-radius: 7px;
          }
        }
      }

      .c_full {
        display: flex;
        flex-direction: column;
        margin-bottom: 20px;
        background: #fff;
        border-radius: 7px;

        .c_full_img {
          width: 100%;
          border-bottom: 4px solid #fafafa;
        }

        .c_radius {
          border-radius: 0 7px 7px 0;
        }

        .c_full_view {
          padding: 14px;
          display: flex;
          flex-direction: column;
          justify-content: center;

          .c_full_f1 {
            font-size: 15px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #333333;
          }

          .c_full_f2 {
            margin-top: 10px;
            font-size: 10px;
            font-family: Source Han Sans CN;
            font-weight: 300;
            color: #333333;
          }

          .c_full_f3 {
            margin-top: 10px;
            font-size: 10px;
            font-family: Source Han Sans CN;
            font-weight: 300;
            color: #999999;
          }

          .c_see_detail {
            display: flex;
            flex-direction: row-reverse;
            width: 100%;
            margin-top: 24px;

            .c_btn1 {
              font-size: 12px;
              font-family: Source Han Sans CN;
              font-weight: 400;
              color: #333333;
              width: 54px;
              height: 26px;
              border: 1px solid #333333;
              border-radius: 2px;
              text-align: center;
              line-height: 26px;
              cursor: pointer;
              box-sizing: border-box;
            }

            .c_btn2 {
              margin-left: 20px;
              font-size: 12px;
              font-family: Source Han Sans CN;
              font-weight: 400;
              color: #fff;
              width: 54px;
              height: 26px;
              background: #333333;
              border-radius: 2px;
              text-align: center;
              line-height: 26px;
              cursor: pointer;
            }
          }
        }
      }
    }
  }
}
</style>
